package com.itheima;

import java.io.IOException;
import java.io.InputStream;

/**
 * @auther Macrydy
 * @date 2020/7/13 11:09
 */
public class Demo1 {
    public static void main(String[] args) throws IOException {
        //使用类加载器直接获取src目录下资源文件
        ClassLoader systemClassLoader = ClassLoader.getSystemClassLoader();
        InputStream resourceAsStream = systemClassLoader.getResourceAsStream("a.txt");

        byte[] bytes = new byte[1024];
        int len = resourceAsStream.read(bytes);
        System.out.println(new String(bytes,0,len));

    }
}
